package annotation;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class UseCaseTracker {
    public static void
    trackUseCases(List<Integer> useCases, Class<?> cl) {
        for (Method method : cl.getDeclaredMethods()) {
            Annotation annotation = method.getAnnotation(UseCase.class);
            if (annotation != null) {
                System.out.println("Found Use Case " +
                        ((UseCase) annotation).id() + "\n " + ((UseCase) annotation).des());
                useCases.remove(Integer.valueOf(((UseCase) annotation).id()));
            }
        }
    }

    public static void main(String[] args) {
        List<Integer> list = IntStream.range(47, 51).boxed().collect(Collectors.toList());
        trackUseCases(list,PasswordUtils.class);
    }
}
